using System;
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// 银联支付请求参数模型
/// </summary>
public class UnionPayRequest
{
    /// <summary>
    /// 请求时间戳
    /// </summary>
    [JsonProperty("requestTimestamp")]
    public DateTime RequestTimestamp { get; set; }

    /// <summary>
    /// 商户订单号
    /// </summary>
    [JsonProperty("merOrderId")]
    public string MerOrderId { get; set; }

    /// <summary>
    /// 商户号
    /// </summary>
    [JsonProperty("mid")]
    public string Mid { get; set; }

    /// <summary>
    /// 终端号
    /// </summary>
    [JsonProperty("tid")]
    public string Tid { get; set; }

    /// <summary>
    /// 总金额
    /// </summary>
    [JsonProperty("totalAmount")]
    public string TotalAmount { get; set; }

    /// <summary>
    /// 子应用ID
    /// </summary>
    [JsonProperty("subAppId")]
    public string SubAppId { get; set; }

    /// <summary>
    /// 交易类型
    /// </summary>
    [JsonProperty("tradeType")]
    public string TradeType { get; set; }

    /// <summary>
    /// 子用户标识
    /// </summary>
    [JsonProperty("subOpenId")]
    public string SubOpenId { get; set; }

    /// <summary>
    /// 消息ID
    /// </summary>
    [JsonProperty("msgId")]
    public string MsgId { get; set; }

    /// <summary>
    /// 商户保留域
    /// </summary>
    [JsonProperty("srcReserve")]
    public string SrcReserve { get; set; }

    /// <summary>
    /// 机构中间号
    /// </summary>
    [JsonProperty("instMid")]
    public string InstMid { get; set; }

    /// <summary>
    /// 商品信息列表
    /// </summary>
    [JsonProperty("goods")]
    public List<GoodsInfo> Goods { get; set; }

    /// <summary>
    /// 附加数据
    /// </summary>
    [JsonProperty("attachedData")]
    public string AttachedData { get; set; }

    /// <summary>
    /// 过期时间
    /// </summary>
    [JsonProperty("expireTime")]
    public DateTime ExpireTime { get; set; }

    /// <summary>
    /// 商品标签
    /// </summary>
    [JsonProperty("goodsTag")]
    public string GoodsTag { get; set; }

    /// <summary>
    /// 订单描述
    /// </summary>
    [JsonProperty("orderDesc")]
    public string OrderDesc { get; set; }

    /// <summary>
    /// 原始金额
    /// </summary>
    [JsonProperty("originalAmount")]
    public string OriginalAmount { get; set; }

    /// <summary>
    /// 产品ID
    /// </summary>
    [JsonProperty("productId")]
    public string ProductId { get; set; }

    /// <summary>
    /// 分账标志
    /// </summary>
    [JsonProperty("divisionFlag")]
    public string DivisionFlag { get; set; }

    /// <summary>
    /// 异步分账标志
    /// </summary>
    [JsonProperty("asynDivisionFlag")]
    public string AsynDivisionFlag { get; set; }

    /// <summary>
    /// 平台金额
    /// </summary>
    [JsonProperty("platformAmount")]
    public string PlatformAmount { get; set; }

    /// <summary>
    /// 子订单列表
    /// </summary>
    [JsonProperty("subOrders")]
    public List<SubOrder> SubOrders { get; set; }

    /// <summary>
    /// 通知地址
    /// </summary>
    [JsonProperty("notifyUrl")]
    public string NotifyUrl { get; set; }

    /// <summary>
    /// 安全交易标志
    /// </summary>
    [JsonProperty("secureTransaction")]
    public string SecureTransaction { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    [JsonProperty("userId")]
    public string UserId { get; set; }

    /// <summary>
    /// 限制信用卡标志
    /// </summary>
    [JsonProperty("limitCreditCard")]
    public string LimitCreditCard { get; set; }

    /// <summary>
    /// 分期数
    /// </summary>
    [JsonProperty("installmentNumber")]
    public string InstallmentNumber { get; set; }

    /// <summary>
    /// 姓名
    /// </summary>
    [JsonProperty("name")]
    public string Name { get; set; }

    /// <summary>
    /// 手机号
    /// </summary>
    [JsonProperty("mobile")]
    public string Mobile { get; set; }

    /// <summary>
    /// 证件类型
    /// </summary>
    [JsonProperty("certType")]
    public string CertType { get; set; }

    /// <summary>
    /// 证件号码
    /// </summary>
    [JsonProperty("certNo")]
    public string CertNo { get; set; }

    /// <summary>
    /// 固定买家标志
    /// </summary>
    [JsonProperty("fixBuyer")]
    public string FixBuyer { get; set; }

    /// <summary>
    /// 商户返回参数
    /// </summary>
    [JsonProperty("retCommParams")]
    public RetCommParams RetCommParams { get; set; }

    /// <summary>
    /// 费率
    /// </summary>
    [JsonProperty("feeRatio")]
    public string FeeRatio { get; set; }

    /// <summary>
    /// 成本补贴
    /// </summary>
    [JsonProperty("costSubsidy")]
    public string CostSubsidy { get; set; }

    /// <summary>
    /// 预授权交易标志
    /// </summary>
    [JsonProperty("preauthTransaction")]
    public string PreauthTransaction { get; set; }

    /// <summary>
    /// 客户端IP
    /// </summary>
    [JsonProperty("clientIp")]
    public string ClientIp { get; set; }
}

/// <summary>
/// 商品信息
/// </summary>
public class GoodsInfo
{
    /// <summary>
    /// 单位
    /// </summary>
    [JsonProperty("unit")]
    public string Unit { get; set; }

    /// <summary>
    /// 子商户ID
    /// </summary>
    [JsonProperty("subMerchantId")]
    public string SubMerchantId { get; set; }

    /// <summary>
    /// 子订单金额
    /// </summary>
    [JsonProperty("subOrderAmount")]
    public string SubOrderAmount { get; set; }

    /// <summary>
    /// 数量
    /// </summary>
    [JsonProperty("quantity")]
    public string Quantity { get; set; }

    /// <summary>
    /// 商品ID
    /// </summary>
    [JsonProperty("goodsId")]
    public string GoodsId { get; set; }

    /// <summary>
    /// 单价
    /// </summary>
    [JsonProperty("price")]
    public string Price { get; set; }

    /// <summary>
    /// 商品分类
    /// </summary>
    [JsonProperty("goodsCategory")]
    public string GoodsCategory { get; set; }

    /// <summary>
    /// 折扣
    /// </summary>
    [JsonProperty("discount")]
    public string Discount { get; set; }

    /// <summary>
    /// 商品描述
    /// </summary>
    [JsonProperty("body")]
    public string Body { get; set; }

    /// <summary>
    /// 商品名称
    /// </summary>
    [JsonProperty("goodsName")]
    public string GoodsName { get; set; }

    /// <summary>
    /// 商户订单号
    /// </summary>
    [JsonProperty("merOrderId")]
    public string MerOrderId { get; set; }
}

/// <summary>
/// 子订单
/// </summary>
public class SubOrder
{
    /// <summary>
    /// 总金额
    /// </summary>
    [JsonProperty("totalAmount")]
    public string TotalAmount { get; set; }

    /// <summary>
    /// 商户号
    /// </summary>
    [JsonProperty("mid")]
    public string Mid { get; set; }

    /// <summary>
    /// 商户订单号
    /// </summary>
    [JsonProperty("merOrderId")]
    public string MerOrderId { get; set; }
}

/// <summary>
/// 商户返回参数
/// </summary>
public class RetCommParams
{
    /// <summary>
    /// 车牌号
    /// </summary>
    [JsonProperty("vehicleNo")]
    public string VehicleNo { get; set; }

    /// <summary>
    /// 食品订单类型
    /// </summary>
    [JsonProperty("foodOrderType")]
    public string FoodOrderType { get; set; }

    /// <summary>
    /// 停车场ID
    /// </summary>
    [JsonProperty("parkId")]
    public string ParkId { get; set; }
}
